<script setup name="singer-list">
import { Right, MoreOne } from '@icon-park/vue-next'
import IconPark from '@/components/common/IconPark.vue'

const props = defineProps({
  singerlist: {
    type: Array
  },
  loading: {
    type: Boolean
  }
})
</script>

<template>
  <div class="more">
    <h3>热门歌手</h3>
    <IconPark :icon="Right" theme="filled" :size="5" />
    <IconPark :icon="MoreOne" theme="filled" :size="5" />
  </div>
  <van-skeleton v-if="loading">
    <template #template>
      <div class="skeleton" v-for="i in 4" :key="i">
        <van-skeleton-image image-size="80" />
        <van-skeleton-paragraph row-width="50%" />
      </div>
    </template>
  </van-skeleton>
  <van-swipe v-else :show-indicators="false" loop autoplay="5000" duration="3000" :width="98">
    <van-swipe-item v-for="item in singerlist" :key="item.id">
      <div class="icon-slot">
        <van-row gutter="24" justify="space-around" align="center">
          <van-col span="6">
            <RouterLink class="singer-list" :to="{ path: '/singer/detail', query: { id: item.id } }">
              <van-image width="80px" height="80px" :src="item.picUrl" round />
              <span class="singer-list-name">{{ item.name }}</span>
            </RouterLink>
          </van-col>
        </van-row>
      </div>
    </van-swipe-item>
  </van-swipe>
</template>

<style scoped lang="scss">
.singer-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0 !important;

  &-name {
    width: 90px;
    margin-top: 6px;
    font-size: 10px;
    text-align: center;
    color: var(--vt-c-info-text);
  }
}

.van-col--6 {
  padding: 0 !important;
}

.van-skeleton--animate {
  justify-content: space-between;

  .skeleton {
    display: flex;
    flex-direction: column;
    align-items: center;

    .van-skeleton-image {
      border-radius: 50%;
    }
  }
}
</style>